package com.itheima.web.controller;

import cn.hutool.core.date.DateUtil;
import com.itheima.web.manager.AnalysisManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.ParseException;
import java.util.Date;

@RestController
public class AnalysisController {

    @Autowired
    private AnalysisManager analysisManager;

    // 统计展示
    @GetMapping("/dashboard/summary")
    public ResponseEntity summary(){
        return analysisManager.summary();
    }
    //统计展示
    @GetMapping("/dashboard/users")
    public ResponseEntity users(
            @RequestParam(value = "sd")String startDate,
            @RequestParam(value = "ed")String endDate,
            @RequestParam(value = "type")Integer type
            ) throws ParseException {

        return analysisManager.users(startDate,endDate,type);
    }
}
